package com.youpai.platform.common.util;


import com.youpai.platform.user.web.entity.dto.UserDTO;

/**
 * @date: 2021/11/29 23:03
 * @author: Anna
 * @version: 1.0
 * @description: 用户信息
 */
public class UserContext {

    private static final ThreadLocal<UserDTO> userThreadLocal = new ThreadLocal<>();

    public static void setUserContext(UserDTO userDTO){
        userThreadLocal.set(userDTO);
    }

    public static UserDTO getUserContext(){
        return userThreadLocal.get();
    }

    public static void cleanUserContext(){
        userThreadLocal.remove();
    }
}
